package com.java.s2;
public class PaoSort {
    /**
     * 冒泡排序
     */
    public static void main(String[] args) {
        int data[]=new int[]{33,21,4,122,0,56,243};
        Sort(data);
        print(data);
    }
    //冒泡排序
    private static void Sort(int[] data) {
        for (int i = 0;i<data.length;i++){
            for (int j=0;j<data.length-1;j++){
                if (data[j]>data[j+1]) {
                    data[j] = data[j] ^ data[j + 1];
                    data[j + 1] = data[j] ^ data[j + 1];
                    data[j] = data[j] ^ data[j + 1];
                }
            }
        }
    }
    //输出数组
    private static void print(int[] data) {
        for (int i:data
             ) {
            System.out.print(i+"、");
        }
        System.out.println();
    }
}
